#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
#include <QListWidget>

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    //设置单选按钮 男默认选中,改完项目名称要运行一下才能用
    ui->rbtnman->setChecked(true);

    //选中女  打印信息
    connect(ui->radioButton_2,&QRadioButton::clicked,[=](){
        qDebug()<<"选中了女";
    });

    //多选按钮
    connect(ui->checkBox_4,&QCheckBox::stateChanged,[=](int statue){
        qDebug()<<statue;
    });


    //利用list widget写诗
    QListWidgetItem * item = new QListWidgetItem("chu he ri dang wu");
    ui->listWidget->addItem(item);
    //设置居中
    item->setTextAlignment(Qt::AlignHCenter);

    //QStringList QList<Qstring>
    QStringList list;
    list<<"chu he ri dang wu"<<"han di he xia tu"<<"shui zhi pan zhong can"<<"li li jie xin ku";
    ui->listWidget->addItems(list);

}

Widget::~Widget()
{
    delete ui;
}
